// 登陆凭证缓存key
const voucherStorageKey = 'Authorization';

// const storage = window.sessionStorage;
const storage = window.localStorage;

export default {
	getVoucher: () => storage.getItem(voucherStorageKey),
	setVoucher: (voucher) => storage.setItem(voucherStorageKey, voucher),
	delVoucher: () => storage.removeItem(voucherStorageKey),
	get: (name) => {
		const value = storage.getItem(name);
		if (value) {
			return JSON.parse(value)
		}
		return value;
	},
	set: (name, value) => {
		storage.setItem(name, JSON.stringify(value))
	},
	del: (name) => storage.removeItem(name)
};